var el=document.getElementById("<?php echo $_GET['el'] ?>"),
  p="<?php echo(isset($_GET['p'])?$_GET['p']:'') ?>",
  w=p.split(';'),wc=w.length,wi,wdef;

var opts='';
for(wi=0;wi<wc;++wi){
  if(w[wi].substr(0,1)=='?'){ el.label=w[wi].substr(1); }
  else if(w[wi].substr(0,1)=='@'){
    <?php include'_events.php' ?>
  }
  else if(w[wi].substr(0,1)=='!'){
    opts+="<option selected=\"selected\">"+w[wi].substr(1)+"</option>";
  }
  else if(w[wi].substr(0,1)=='_'){
    opts+="<option>"+w[wi].substr(1)+"</option>";
  }
  else{
    opts+="<option>"+w[wi]+"</option>"
  }
}
//alert(opts);
el.innerHTML="";

var months=[31,28,31,30,31,30,31,31,30,31,30,31];
var now=new Date();

var month=now.getMonth();
var day=now.getDate();
var thismonth=months[month];
var nextmonth=day+29-thismonth;
var lastweek=day-7;
var yesterday=day-1;
var weekday=now.getDay();



alert(nextmonth);

var table,td,tr;
table=document.createElement("table");
table.style.border="1px solid";
table.style.padding="10px";
tr=document.createElement("tr");
table.appendChild(tr);

var mi,di;
for(di=lastweek;di<yesterday;++di){
    now.setDate(di);
    td=document.createElement("td");
    tr.appendChild(td);
    test=document.createElement("div");
    test.innerHTML=di+1+"<br/>"+(now.getDay()+1);
    td.appendChild(test);
}
td=document.createElement("td");
tr.appendChild(td);
test=document.createElement("div");
test.innerHTML="<input size=\"2\" value=\""+day+"\"/>";
td.appendChild(test);

for(di=day;di<thismonth;++di){
    now.setDate(di);
    td=document.createElement("td");
    tr.appendChild(td);
    test=document.createElement("div");
    test.innerHTML=di+1+"<br/>"+(now.getDay()+1);
    td.appendChild(test);
}
now.setMonth(month+1);
for(di=0;di<nextmonth;++di){
    now.setDate(di);
    td=document.createElement("td");
    tr.appendChild(td);
    test=document.createElement("div");
    test.innerHTML=(di+1)+"<br/>"+(now.getDay()+1);
    td.appendChild(test);
}
/*el.txt.size=3;
el.txt.style.textAlign="right";
el.txt.parent=el;*/
el.appendChild(table);

//alert(el.id+")))"+el.label+el.valueTrue+el.valueFalse);